<?php

use yii\db\Migration;
use yii\db\Schema;

class m170602_101422_CREATE_TABLE_AREA extends Migration
{
    public function up()
    {
        $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
        // 游轮基础信息
        $this->createTable('area', [
            "id" =>           Schema::TYPE_PK,
            "name" =>         Schema::TYPE_STRING.    "(32) NULL COMMENT '名称'",
            "en_name" =>      Schema::TYPE_STRING.    "(128) NULL COMMENT '名称'",
            "code" =>      	  Schema::TYPE_STRING.    "(8)  NULL COMMENT '三字简码'",
            "status" =>       Schema::TYPE_INTEGER.   "(1) DEFAULT  '1' COMMENT '1正常  2禁用'",
            "created_at" =>   Schema::TYPE_DATETIME.  " NULL",
            "updated_at" =>   Schema::TYPE_TIMESTAMP. " NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP",
        ], $tableOptions);
    }

    public function down()
    {
        echo "m170602_101422_CREATE_TABLE_AREA cannot be reverted.\n";

        return false;
    }

}
